home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / flilib.zip / FLISRC.ZIP / CSETCOLO.ASM < prev    next >
Assembly Source File  |  1989-12-18  |  2KB  |  75 lines

  1. ;csetcolo.asm - contains fii_reg_fcuncomp().
  2.  
  3. _TEXT    SEGMENT  BYTE PUBLIC 'CODE'
  4.  
  5.     ASSUME  CS: _TEXT 
  6.  
  7.     ;fii_reg_fcuncomp(csource)
  8.     ;set the color palette hardware from a compressed source 
  9.     ;of format:
  10.     ;WORD # of runs, run1, run2, ...,runn
  11.     ;each run is of form:
  12.     ;BYTE colors to skip, BYTE colors to set, r1,g1,b1,r2,g2,b2,...,rn,gn,bn
  13.     public _fii_reg_fcuncomp
  14. _fii_reg_fcuncomp proc far
  15.     push bp
  16.     mov bp,sp
  17.     push ds
  18.     push si
  19.     push di
  20.     push cx
  21.     push bx
  22.     cld
  23.  
  24.     lds si,[bp+4+2]    ;load the source compressed color data
  25.     mov di,0        ;clear dest color index 
  26.     lodsw
  27.     mov bx, ax       ;get the count of color runs
  28.     test bx,bx
  29.     jmp endcu
  30. cu:
  31.     lodsb        ;get the colors to skip
  32.     add di,ax    ;add to color index
  33.     lodsb        ;get the count of colors to set
  34.     mov cx,ax    ;use it as a loop counter
  35.     or  cx,cx    ;test for zero
  36.     jnz    set1c
  37.     mov cx,256
  38. set1c:
  39.     mov    dx,3c8h    ;point dx to vga color control port
  40.     mov ax,di
  41.     out dx,al    ;say which color index to start writing to
  42.     inc di        ;bump color index
  43.     inc dx        ;point port to vga color data
  44.     ;jmp s1        ;stall as per IBM VGA tech spec to give hardware time to settle
  45. s1:
  46.     lodsb        ;get red component
  47.     out dx,al    ;tell the video DAC where it's at
  48.     ;jmp s2        ;stall some more for poor slow hardware
  49. s2:
  50.     lodsb        ;same same with green component
  51.     out dx,al
  52.     ;jmp s3
  53. s3:
  54.     lodsb        ;same with blue
  55.     out dx,al
  56.     loop set1c
  57.  
  58.     dec bx
  59. endcu:
  60.     jnz cu
  61.  
  62.     pop bx
  63.     pop cx
  64.     pop di
  65.     pop si
  66.     pop ds
  67.     pop    bp
  68.     ret    
  69.  
  70. _fii_reg_fcuncomp endp
  71.  
  72.  
  73. _TEXT    ENDS
  74. END
  75.